#作业实验8 二小题
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from selenium.webdriver.common.action_chains import ActionChains#鼠标悬停

op = webdriver.ChromeOptions()
op.add_experimental_option('excludeSwitches', ['enable-automation'])
op.add_experimental_option('useAutomationExtension', False)
op.add_argument("--start-maximized")#窗口最大化
#打开Chrome浏览器
driver = webdriver.Chrome(options=op)

driver.get(r"https://jqueryui.com/slider/#multiple-vertical")

#特殊操作
iframe = driver.find_element(By.CSS_SELECTOR, "#content > iframe")
driver.switch_to.frame(iframe)

ele1=driver.find_element(By.XPATH,"//*[@id='master']/span")#横向元素
ele2=driver.find_element(By.CSS_SELECTOR,"#eq > span:nth-child(1)")#纵向元素
chains=ActionChains(driver)
sleep(3)
chains.drag_and_drop_by_offset(ele1,xoffset=100,yoffset=0).perform()#横向拖动
sleep(2)
chains.drag_and_drop_by_offset(ele2,xoffset=0,yoffset=100).perform()#纵向拖动
sleep(2)

driver.quit()